# 字典，不是序列，键值对 相当于java中的map

data = {}
print(type(data))

data['name'] = "an"
data['age'] = 30
data['school'] = "dsdasf"
print(data)
print(data['name'])
print('修改')
print(data.update({'age': 22}))

print('-----获取所有键、值-----')
print(data.keys())
print(data.values())
print(data.items())
for key, value in data.items():
    print(key, value)

print('排序')
data2 = {'name': 1, 'school': 3, 'age': 2}
print(sorted(data2.items(), key=lambda d: d[0]))

print('删除')
del data['name']
print(data)
data.pop('age')
print(data)

print(data)
print('school' in data)